package cn.sczhyt.common.utils;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 * 创建者  罗世杰
 * 创建日期 2020/8/24
 * 描述 目录删除工具
 */
public class FolderUtils {
    public static List<String> list=new ArrayList<>();

    public static boolean deleteDir(File dir) {
        if (dir.isDirectory()) {
            String[] children = dir.list();
            for (int i = 0; i < children.length; i++) {
                boolean success = deleteDir
                        (new File(dir, children[i]));
                if (!success) {
                    return false;
                }
            }
        }
        if(dir.delete()) {
            list.add(dir.getPath());
            return true;
        } else {
            return false;
        }
    }
}
